﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace ADUSWebApp.Models
{

    /// <summary>
    /// 检查用户是否存在
    /// </summary>
    public class UserModel
    {
        [Required]
        [DisplayName("用户名")]
        public string LoginName { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [DisplayName("密码")]
        public string LoginPassword { get; set; }

        [Required]
        [DisplayName("邮箱")]
        public string Email { get; set; }
    }

    /// <summary>
    /// 注册用户
    /// </summary>
    public class EnrollModel
    {
        [Required(ErrorMessage = "用户名不能为空!")]
        [DisplayName("用户名")]
        public string LoginName { get; set; }

        [Required(ErrorMessage = "密码不能为空")]
        [DataType(DataType.Password)]
        [DisplayName("密码")]
        [StringLength(10, ErrorMessage = "密码长度不能小于5位", MinimumLength = 5)]
        public string LoginPassword { get; set; }

        [Required(ErrorMessage = "确认密码不能为空!")]
        [DataType(DataType.Password)]
        [DisplayName("确认密码")]
        [StringLength(10, ErrorMessage = "确认密码长度不能小于5位", MinimumLength = 5)]
        public string ConfirmPassword { get; set; }

        [Required]
        [DisplayName("邮箱")]
        //[DataType(DataType.EmailAddress)]
        [RegularExpression(@"^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$", ErrorMessage = "电子邮件格式错误")]
        public string Email { get; set; }
    }

    //public interface IMemberService
    //{
    //    bool checkUser(string loginName, string loginpassword);
    //    MembershipCreateStatus CreateUser(string loginName, string loginpassword, string loginemail);
    //    bool ChangePassword(string loginName, string oldloginPassword, string newloginPassword);
    //}
}